package de.szut.entity;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;

import de.szut.impl.AbilityTreeDaoImpl;

/**
 * Entity class for ability-trees containing several abilities.
 * Created by dzebcuks on 19.08.13.
 */
@DatabaseTable(daoClass = AbilityTreeDaoImpl.class)
public class AbilityTree implements Serializable {

    /**
     * Unique identifier for the object.
     */
    @DatabaseField(generatedId = true)
    private int id;

    /**
     * Name of the ability tree.
     */
    @DatabaseField
    private String name;

    /**
     * Contains all available base-abilities.
     * Can´t be null.
     */
    @ForeignCollectionField(eager = false)
    private Collection<BaseAbility> abilities = new ArrayList<BaseAbility>();

    public Collection<BaseAbility> getAbilities() {
        return abilities;
    }

    public void setAbilities(Collection<BaseAbility> abilities) {
        this.abilities = abilities;
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public void setName(String name) {
        this.name = name;
    }

    public void addAbility(BaseAbility baseAbility) {
        this.abilities.add(baseAbility);
    }
}
